home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac100% 1998 November
/
MAC100-1998-11.ISO.7z
/
MAC100-1998-11.ISO
/
オンラインソフト定点観測
/
ユーティリティ
/
Mops 3.2.sea
/
Mops 3.2
/
Mops ƒ
/
PathsMod.txt
< prev
next >
Wrap
Text File
|
1997-11-05
|
2KB
|
77 lines
¥ We call this module if a list of HFS path designators is to be used to
¥ find a file. First we grab the file with the list
¥ of path designators (one per line). For each designator we prepend
¥ it to the given filename, and attempt to open the file. We keep
¥ going until either the open succeeds or we run out of path designators.
¥ If the open succeeds we leave the name in the fcb set to the full
¥ path name. If the open fails we restore the name to what it was.
objPtr PATHS_F class_is file
objHandle PATHS_HDL
string NAME
string FULLNAME
string PDS
local OWP { fcb mode ¥ ret? -- rc }
: OPENLOOP
BEGIN ¥ Loop over path designators
len: pds
NIF ¥ Not found
all: name fcb name: file ¥ Restore orig name
FNF EXIT
THEN
RET chsearch: pds -> ret?
pds ->: fullName name $add: fullName
all: fullName fcb name: class_as> file
fcb openReadOnly: class_as> file NIF 0 EXIT THEN ¥ Found
step: pds ret? negate skip: pds
AGAIN ;
:loc OWP
reset: pds
len: pds NIF FNF EXIT THEN
¥ If no paths, we return a "file not found" error.
false -> use_paths? ¥ so we don't get recursively entered!
getName: [ fcb ]
put: name new: fullName
openLoop
release: name release: fullName
true -> use_paths?
;loc
: GETPATHS ¥ ( addr len -- )
true -> use_paths? ¥ This becomes the default now
¥ that GETPATHS has been called
keep: pathsMod
nil?: pds IF new: pds ELSE clear: pds THEN
release: paths_hdl ['] file newObj: paths_hdl
obj: paths_hdl -> paths_f
name: paths_f openReadOnly: paths_f
IF
msg# 133 ¥ Warning - couldn't find paths file
release: paths_hdl nilP -> paths_f EXIT
THEN
size: paths_f setsize: pds
all: pds read: paths_f drop
close: paths_f drop releaseObj: paths_hdl ;
: .PATHS { ¥ ret? -- }
nil?: pds ?EXIT
reset: pds
BEGIN
len: pds 0EXIT
RET chsearch: pds -> ret?
get: pds type cr
step: pds ret? negate skip: pds
AGAIN ;
: REL release: pds ;
' rel setRelease